package org.jamailia.core.service;

import org.jamailia.core.component.GenericDao;
import org.springframework.transaction.PlatformTransactionManager;

/**
 * OrmEnabledService.
 *
 * @author Rene Gielen
 */
public abstract class OrmEnabledService {

    GenericDao genericDao;
    PlatformTransactionManager transactionManager;

    public GenericDao getGenericDao() {
        return genericDao;
    }

    public void setGenericDao( GenericDao genericDao ) {
        this.genericDao = genericDao;
    }

    public PlatformTransactionManager getTransactionManager() {
        return transactionManager;
    }

    public void setTransactionManager( PlatformTransactionManager transactionManager ) {
        this.transactionManager = transactionManager;
    }

    public void refresh( Object entity ) {
        if (entity != null) {
            getGenericDao().refresh(entity);
        }
    }
    
    public void clear() {
        getGenericDao().clear();
    }
}
